﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace MoneyManagerNET.Presentation.ViewModel
{
    using Model;
    using MoneyManagerNET.Presentation.ViewModel.Base;

    
    public class EditAccountViewModel:ViewModelBase<IAccount>
    {
        public string Id { get { return ModelAs.Id.ToString(); }  }
        
        public string Name { get { return ModelAs.Name; } set { ModelAs.Name = value; OnChange("Name"); } }
        
        public decimal Balance { get { return ModelAs.Balance; } set { ModelAs.Balance= value; OnChange("Balance"); } }

        public string CurrencyName { get { return (ModelAs.Currency==null)?"select currency":ModelAs.Currency.Name; } }

        public enum AccountStatus { Open, Closed }

        public AccountStatus Status { 
            get { return ModelAs.Status?AccountStatus.Open:AccountStatus.Closed; } 
            set { ModelAs.Status = value==AccountStatus.Open?true:false; OnChange("Status"); } }

        CollectionView _PossibleStatuses;
        public CollectionView PossibleStatuses { get { if (_PossibleStatuses == null)_PossibleStatuses = new CollectionView(Enum.GetValues(typeof(AccountStatus))); return _PossibleStatuses; } set { _PossibleStatuses = value; OnChange("PossibleStatuses"); } }

    }
}
